package com.lvs.zmwz.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.lvs.zmwz.comm.DictionaryEnum;
import com.lvs.zmwz.entity.Shop;
import com.lvs.zmwz.entity.ShopType;
import com.lvs.zmwz.mapper.ShopTypeMapper;
import com.lvs.zmwz.service.IShopTypeService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.lvs.zmwz.util.QPage;
import org.springframework.stereotype.Service;

/**
 * <p>
 * 商品分类表 服务实现类
 * </p>
 *
 * @author 
 * @since 2022-07-22
 */
@Service
public class ShopTypeServiceImpl extends ServiceImpl<ShopTypeMapper, ShopType> implements IShopTypeService {

    /**
     * 分类列表
     * @param qPage
     * @param sysManagerSearch
     * @return
     */
    @Override
    public IPage<ShopType> getListAll(QPage qPage, ShopType sysManagerSearch) {
        QueryWrapper<ShopType> queryWrapper=new QueryWrapper<>();
        queryWrapper.lambda().like(StringUtils.isNotEmpty(sysManagerSearch.getTypeName()),ShopType::getTypeName,sysManagerSearch.getTypeName());
        queryWrapper.eq("is_del", DictionaryEnum.IS_DEL_N.getCode());
        queryWrapper.orderByDesc("ctime");
        IPage<ShopType> hjManagerIPage=this.page(new Page<>(qPage.getOffset(), qPage.getLimit()),queryWrapper);
        return hjManagerIPage;
    }
}
